import App from "./App.vue";
import router from "./router";
import { Message } from "element-ui";
import "@/styles/global.scss";
import store from "./store/index.js";
import http from "./axios";

Vue.config.productionTip = false;
Vue.prototype.$http = http;

let duration = 1200;
Vue.prototype.$message = function(msg) {
  Message({ message: msg, duration });
};
Vue.prototype.$message.success = function(msg) {
  Message.success({ message: msg, duration });
};
Vue.prototype.$message.error = function(msg) {
  Message.error({ message: msg, duration });
};

Vue.mixin({
  data() {
    return {
      // 获取列表的参数对象
      queryInfo: {
        query: "",
        // 当前的页数
        pagenum: 1,
        // 当前每页显示多少条数据
        pagesize: 10,
      },
    };
  },
  computed: {
    uploadUrl() {
      return "http://dev-mall-admin.siyuyunai.com/mallAdmin/upload?files";
    },
    showImgUrl() {
      return "http://dev-mall-admin.siyuyunai.com/files/download?ids=";
    },
  },
  methods: {
    getAuthHeaders() {
      return {
        "token-mall-admin": store.state.token || "",
      };
    },
  },
});

// 全局关闭 console.log 功能
window.console.log = () => {};

new Vue({
  store,
  router,
  render: (h) => h(App),
}).$mount("#app");
